<?php

namespace yiike\finance\models;

use Yii;
use yii\base\Model;
use yii\data\ActiveDataProvider;
use yiike\finance\models\ComboAllot;

/**
* ComboAllotSearch represents the model behind the search form about `yiike\finance\models\ComboAllot`.
*/
class ComboAllotSearch extends ComboAllot
{
/**
* @inheritdoc
*/
public function rules()
{
return [
[['order_id', 'user1', 'user2', 'user3', 'user4', 'user5', 'user6', 'user7', 'user8', 'user9', 'user10', 'user11', 'agent_uid', 'status', 'settlement_at'], 'integer'],
            [['user1_profit', 'user2_profit', 'user3_profit', 'user4_profit', 'user5_profit', 'user6_profit', 'user7_profit', 'user8_profit', 'user9_profit', 'user10_profit', 'user11_profit', 'yct_price', 'unlock_rate', 'user1_unlock', 'user2_unlock', 'user3_unlock', 'user4_unlock', 'user5_unlock', 'user6_unlock', 'user7_unlock', 'user8_unlock', 'user9_unlock', 'user10_unlock', 'user11_unlock', 'agent_cost'], 'number'],
];
}

/**
* @inheritdoc
*/
public function scenarios()
{
// bypass scenarios() implementation in the parent class
return Model::scenarios();
}

/**
* Creates data provider instance with search query applied
*
* @param array $params
*
* @return ActiveDataProvider
*/
public function search($params)
{
$query = ComboAllot::find();

$dataProvider = new ActiveDataProvider([
'query' => $query,
]);

$this->load($params);

if (!$this->validate()) {
// uncomment the following line if you do not want to any records when validation fails
// $query->where('0=1');
return $dataProvider;
}

$query->andFilterWhere([
            'order_id' => $this->order_id,
            'user1' => $this->user1,
            'user2' => $this->user2,
            'user3' => $this->user3,
            'user4' => $this->user4,
            'user5' => $this->user5,
            'user6' => $this->user6,
            'user7' => $this->user7,
            'user8' => $this->user8,
            'user9' => $this->user9,
            'user10' => $this->user10,
            'user11' => $this->user11,
            'user1_profit' => $this->user1_profit,
            'user2_profit' => $this->user2_profit,
            'user3_profit' => $this->user3_profit,
            'user4_profit' => $this->user4_profit,
            'user5_profit' => $this->user5_profit,
            'user6_profit' => $this->user6_profit,
            'user7_profit' => $this->user7_profit,
            'user8_profit' => $this->user8_profit,
            'user9_profit' => $this->user9_profit,
            'user10_profit' => $this->user10_profit,
            'user11_profit' => $this->user11_profit,
            'yct_price' => $this->yct_price,
            'unlock_rate' => $this->unlock_rate,
            'user1_unlock' => $this->user1_unlock,
            'user2_unlock' => $this->user2_unlock,
            'user3_unlock' => $this->user3_unlock,
            'user4_unlock' => $this->user4_unlock,
            'user5_unlock' => $this->user5_unlock,
            'user6_unlock' => $this->user6_unlock,
            'user7_unlock' => $this->user7_unlock,
            'user8_unlock' => $this->user8_unlock,
            'user9_unlock' => $this->user9_unlock,
            'user10_unlock' => $this->user10_unlock,
            'user11_unlock' => $this->user11_unlock,
            'agent_uid' => $this->agent_uid,
            'agent_cost' => $this->agent_cost,
            'status' => $this->status,
            'settlement_at' => $this->settlement_at,
        ]);

return $dataProvider;
}
}